for cc=1:length(place)
    %FIRM EXPORT TURNOVER
    prob_stop_exporting.(place{cc})=sum(num_stopped_exporters.(place{cc})(end-99:end))/...
                           sum(num_exporters.(place{cc})(end-100:end-1));
    prob_start_exporting.(place{cc})=sum(num_new_exporters.(place{cc})(end-99:end))/...
                           sum(num_non_exporters.(place{cc})(end-100:end-1));
    
    proportion_new_exporters.(place{cc})=sum(num_all_new_exporters.(place{cc})(end-99:end))/...
                            sum(num_exporters.(place{cc})(end-99:end));
    proportion_stopped_exporters.(place{cc})=sum(num_all_stopped_exporters.(place{cc})(end-99:end))/...
                            sum(num_exporters.(place{cc})(end-100:end-1));
    %PRODUCT CHANGES
        %LOST TO THE OTHER COUNTRY
    prob_exported_lost2for.(place{cc})=sum(num_exportED_lost_for.(place{cc})(end-99:end))/...
                            sum(num_exportED.(place{cc})(end-100:end-1));
    prob_exportED_to_nontraded.(place{cc}) = sum(num_exportED_to_nontraded.(place{cc})(end-99:end))/...
                            sum(num_exportED.(place{cc})(end-100:end-1));
    prob_nontraded_lost2for.(place{cc})=sum(num_nontraded_lost_for.(place{cc})(end-99:end))/...
                            sum(num_nontraded.(place{cc})(end-100:end-1));
    prob_dom_lost2for.(place{cc})=sum(num_produced_lost_for.(place{cc})(end-99:end))/...
                            sum(num_nontraded.(place{cc})(end-100:end-1) + num_exportED.(place{cc})(end-100:end-1));
    
        %LOST DOMESTICALLY
    prob_nontraded_lost2dom.(place{cc})=sum(num_nontraded_lost_dom.(place{cc})(end-99:end))/...
                sum(num_nontraded.(place{cc})(end-100:end-1));
    prob_exported_lost2dom.(place{cc})=sum(num_exportED_lost_dom.(place{cc})(end-99:end))/...
                sum(num_exportED.(place{cc})(end-100:end-1));
    prob_dom_lost2dom.(place{cc})=sum(num_produced_lost_dom.(place{cc})(end-99:end))/...
                sum(num_nontraded.(place{cc})(end-100:end-1) + num_exportED.(place{cc})(end-100:end-1));
            
     %VARIETY TRANSITIONS
%     prob_exported_to_exported.(place{cc}) = sum(num_exported_to_exported.(place{cc})(end-99:end))/...
%                         sum(num_exportED.(place{cc})(end-100:end-1));
%     prob_exported_to_nontraded.(place{cc}) = sum(num_exported_to_nontraded.(place{cc})(end-99:end))/...
%                         sum(num_exportED.(place{cc})(end-100:end-1));
%     prob_exported_to_imported.(place{cc}) = sum(num_exported_to_imported.(place{cc})(end-99:end))/...
%                         sum(num_exportED.(place{cc})(end-100:end-1));
%                     
%     prob_nontraded_to_exported.(place{cc}) = sum(num_nontraded_to_exported.(place{cc})(end-99:end))/...
%                         sum(num_nontraded.(place{cc})(end-100:end-1));
%     prob_nontraded_to_nontraded.(place{cc}) = sum(num_nontraded_to_nontraded.(place{cc})(end-99:end))/...
%                         sum(num_nontraded.(place{cc})(end-100:end-1));
%     prob_nontraded_to_imported.(place{cc}) = sum(num_nontraded_to_imported.(place{cc})(end-99:end))/...
%                         sum(num_nontraded.(place{cc})(end-100:end-1));
%     
%     prob_imported_to_exported.(place{cc}) = sum(num_imported_to_exported.(place{cc})(end-99:end))/...
%                         sum(num_exportED.(place{3-cc})(end-100:end-1));
%     prob_imported_to_nontraded.(place{cc}) = sum(num_imported_to_nontraded.(place{cc})(end-99:end))/...
%                         sum(num_exportED.(place{3-cc})(end-100:end-1));
%     prob_imported_to_imported.(place{cc}) = sum(num_imported_to_imported.(place{cc})(end-99:end))/...
%                         sum(num_exportED.(place{3-cc})(end-100:end-1));
                    
    %AGE AND SIZE MOMENTS
%     avg_size_exporters.(place{cc})=mean(firm_size.(place{cc})(exporters.(place{cc}).(['y' num2str(max_year-1)])));
%     avg_size_non_exporters.(place{cc})=mean(firm_size.(place{cc})(non_exporters.(place{cc}).(['y' num2str(max_year-1)])));
%     avg_revenue_exporters.(place{cc}) = mean(firm_revenue.(place{cc}).(['y' num2str(max_year-1)])(exporters.(place{cc}).(['y' num2str(max_year-1)])));
%     avg_revenue_non_exporters.(place{cc})=mean(firm_revenue.(place{cc}).(['y' num2str(max_year-1)])(non_exporters.(place{cc}).(['y' num2str(max_year-1)])));

%     avg_num_varieties.(place{cc})=mean(firm_produced.(place{cc})([exporters.(place{cc}).(['y' num2str(max_year-1)]);...
%                                                                   non_exporters.(place{cc}).(['y' num2str(max_year-1)])]));
%     
%     firm_age.(place{cc})=max_year-firm_birthday.(place{cc});
%     alive_at_end_firm_list_index.(place{cc})=[exporters.(place{cc}).(['y' num2str(max_year-1)]);...
%                                            non_exporters.(place{cc}).(['y' num2str(max_year-1)])];
%     
%     firm_age5bin.(place{cc})=ceil(firm_age.(place{cc})/5)*5;
%     avg_size_by_age.(place{cc})=accumarray(firm_age.(place{cc})(alive_at_end_firm_list_index.(place{cc})),...
%             firm_size.(place{cc})(alive_at_end_firm_list_index.(place{cc})),[],@(x)mean(x));
%     avg_size_by_5yrbin.(place{cc})=accumarray(firm_age5bin.(place{cc})(alive_at_end_firm_list_index.(place{cc})),...
%             firm_size.(place{cc})(alive_at_end_firm_list_index.(place{cc})),[],@(x)mean(x));


     % CALCULATE EMPLOYMENT TURNOVER MOMENTS (start by initializing
     % vectors)
     share_employment_dom_entrants5yrs.(place{cc})=0;
     share_employment_dom_entrants.(place{cc})=0;
     share_jobs_dom_entrants.(place{cc})=0; %%% JOBS JUST MEANS THE DENOMINATOR IS AVERAGED ACROSS PERIODS INSTEAD OF JUST PERIOD T
     share_jobs_dom_entrants5yrs.(place{cc})=0;
     share_employment_exiters_1yr.(place{cc}) = 0 ;
     share_employment_exiters_5yr.(place{cc}) = 0 ;
     share_jobs_exiters_1yr.(place{cc}) = 0 ;
     share_jobs_exiters_5yr.(place{cc}) = 0 ;
     
     share_firms_dom_entrants5yrs.(place{cc})=0;
     share_firms_dom_entrants.(place{cc})=0;
     share_firms_exiters_1yr.(place{cc}) = 0 ;
     share_firms_exiters_5yr.(place{cc}) = 0 ;
     
     share_output_expanding_entrants_1yr.(place{cc}) = 0;
     share_output_expanding_entrants_5yr.(place{cc}) = 0;
     share_output_contracting_entrants_1yr.(place{cc}) = 0;
     share_output_contracting_entrants_5yr.(place{cc}) = 0;
     
     share_added_output_expanding_incumbents_1yr.(place{cc})=0;
     share_added_output_expanding_incumbents_5yr.(place{cc})=0;
     share_lost_output_contracting_incumbents_1yr.(place{cc})=0;
     share_lost_output_contracting_incumbents_5yr.(place{cc})=0;
     
     share_added_output_expanding_exporters_1yr.(place{cc})=0;
     share_added_output_expanding_exporters_5yr.(place{cc})=0;
     share_lost_output_contracting_exporters_1yr.(place{cc})=0;
     share_lost_output_contracting_exporters_5yr.(place{cc})=0;
     
     share_revenue_new_imports_1yr.(place{cc}) = 0;
     share_revenue_new_imports_5yr.(place{cc}) = 0;
     share_revenue_lost_imports_1yr.(place{cc}) =0;
     share_revenue_lost_imports_5yr.(place{cc}) =0;
     
     share_output_all_stopped_exporters.(place{cc})=0;
     share_output_all_new_exporters.(place{cc})=0;
     share_output_all_stopped_exporters_5yr.(place{cc})=0;
     share_output_all_new_exporters_5yr.(place{cc})=0;
    
     share_export_revenue_all_stopped_exporters_vec.(place{cc}) = 0;
     share_export_revenue_all_new_exporters_vec.(place{cc}) = 0;
     share_export_revenue_all_stopped_exporters_5yr_vec.(place{cc}) = 0;
     share_export_revenue_all_new_exporters_5yr_vec.(place{cc}) = 0;
     
     job_creation_exports_variety_level.(place{cc}) = 0;
     job_destruction_imports_variety_level.(place{cc}) = 0;
     job_creation_exports_variety_level_5yr.(place{cc}) = 0;
     job_destruction_imports_variety_level_5yr.(place{cc}) = 0;
     
     share_employment_large_exiters_1yr.(place{cc}) = 0;
     share_employment_large_exiters_5yr.(place{cc}) = 0;
     share_lost_output_large_incumbents_1yr.(place{cc}) = 0;
     share_lost_output_large_incumbents_5yr.(place{cc}) = 0;
     
     group_export_elasticity_5yr_vec.(place{cc}) = 0;
     
     share_lost_exports_1yr.(place{cc}) = 0;
     share_lost_exports_5yr.(place{cc}) = 0;
     
     std_export_sales_growth_vec.(place{cc}) = 0;
     std_domestic_sales_growth_vec.(place{cc}) = 0;
     export_domestic_relative_volatility.(place{cc}) = 0;
     
     std_export_sales_growth_5yr_vec.(place{cc}) = 0;
     std_domestic_sales_growth_5yr_vec.(place{cc}) = 0;
     export_domestic_relative_volatility_5yr.(place{cc}) = 0;
     
     
     
     std_export_sales_growth_contracting_vec.(place{cc}) = 0;
     std_domestic_sales_growth_contracting_vec.(place{cc}) = 0;
     export_domestic_relative_volatility_contracting.(place{cc}) = 0;
     
     std_export_sales_growth_expanding_vec.(place{cc}) = 0;
     std_domestic_sales_growth_expanding_vec.(place{cc}) = 0;
     export_domestic_relative_volatility_expanding.(place{cc}) = 0;
     
     std_export_sales_growth_surviving_incumbents_vec.(place{cc}) = 0;
     std_domestic_sales_growth_surviving_incumbents_vec.(place{cc}) = 0;
     export_domestic_relative_volatility_surviving_incumbents.(place{cc}) = 0;
     
     export_volatility_regression_sales_coefficient_vec.(place{cc}) = 0;
     export_volatility_regression_domestic_indicator_coefficient_vec.(place{cc}) = 0;
     export_volatility_regression_export_indicator_coefficient_vec.(place{cc}) = 0;  
     
     export_volatility_regression_sales_coef_5yr_vec.(place{cc}) = 0;
     export_volatility_regression_domestic_indicator_coef_5yr_vec.(place{cc}) = 0;
     export_volatility_regression_export_indicator_coef_5yr_vec.(place{cc}) = 0;  
     
     firm_export_creation_5yr_vec.(place{cc}) = 0;
     firm_export_destruction_5yr_vec.(place{cc}) = 0;
     firm_domestic_creation_5yr_vec.(place{cc}) = 0;
     firm_domestic_destruction_5yr_vec.(place{cc}) = 0;
     
     std_export_sales_growth_exporters_5yr_vec.(place{cc}) = 0;
     std_domestic_sales_growth_exporters_5yr_vec.(place{cc}) = 0;
     export_domestic_relative_volatility_exporters_5yr.(place{cc}) = 0;
     
     firm_export_creation_exporters_5yr_vec.(place{cc}) = 0;
     firm_export_destruction_exporters_5yr_vec.(place{cc}) = 0;
     firm_domestic_creation_exporters_5yr_vec.(place{cc}) = 0;
     firm_domestic_destruction_exporters_5yr_vec.(place{cc}) = 0;
     firm_domestic_creation_nonexporters_5yr_vec.(place{cc}) = 0;
     firm_domestic_destruction_nonexporters_5yr_vec.(place{cc}) = 0;
     
     export_volatility_regression_sales_coef_5yr_vec.(place{cc}) = 0;
     export_volatility_regression_domestic_indicator_coef_5yr_vec.(place{cc}) = 0;
     export_volatility_regression_export_indicator_coef_5yr_vec.(place{cc}) = 0;  
     
     export_volatility_regression_sales_coef_exporters_5yr_vec.(place{cc}) = 0;   
     export_volatility_regression_dom_ind_coef_exporters_5yr_vec.(place{cc}) = 0;
     export_volatility_regression_exp_ind_coef_exporters_5yr_vec.(place{cc}) = 0;
     
     export_volatility_regression_dsales_coef_int_exporters_5yr_vec.(place{cc}) = 0;
     export_volatility_regression_esales_coef_int_exporters_5yr_vec.(place{cc}) = 0;
     export_volatility_regression_dom_ind_coef_int_exporters_5yr_vec.(place{cc}) = 0;
     export_volatility_regression_exp_ind_coef_int_exporters_5yr_vec.(place{cc}) = 0;
     
     volatility_export_share_bin_1.(place{cc}) = 0; 
     volatility_export_share_bin_2.(place{cc}) = 0;
     volatility_export_share_bin_3.(place{cc}) = 0;
     volatility_export_share_bin_4.(place{cc}) = 0;
     volatility_export_share_bin_5.(place{cc}) = 0;
     volatility_export_share_bin_6.(place{cc}) = 0;
            
     % TAKE DATA FROM THE LAST 150 YEARS OF THE SIMULATION 
     for yr = max_year-146:max_year-1
          base_yr_index=['y' num2str(yr)];
          yr_index_lag = ['y' num2str(yr-1)];
          yr_index_5yr_lag = ['y' num2str(yr-5)];
          
         % STATISTICS FOR ENTRANTS
         all_entrants.(place{cc}).(base_yr_index) = unique(varown_vec.(place{cc}).(base_yr_index)(produced.(place{cc}).(base_yr_index) & ...
                ~ismember(varown_vec.(place{cc}).(base_yr_index),varown_vec.(place{cc}).(yr_index_lag))));
         share_employment_dom_entrants.(place{cc})(end+1) = (sum(firm_output.(place{cc}).(base_yr_index)(all_entrants.(place{cc}).(base_yr_index)))) / ...
              (sum(firm_output.(place{cc}).(base_yr_index)));
         share_jobs_dom_entrants.(place{cc})(end+1) = (sum(firm_output.(place{cc}).(base_yr_index)(all_entrants.(place{cc}).(base_yr_index)))) / ...
              ((sum(firm_output.(place{cc}).(yr_index_lag))+sum(firm_output.(place{cc}).(base_yr_index)))/2);
         share_firms_dom_entrants.(place{cc}) = share_firms_dom_entrants.(place{cc}) + ...
              (length(all_entrants.(place{cc}).(base_yr_index)))/ ...
              (length(unique(varown_vec.(place{cc}).(base_yr_index)(~isnan(varown_vec.(place{cc}).(base_yr_index))))));
          
           entrants_surviving5yrs.(place{cc}).(base_yr_index) = unique(varown_vec.(place{cc}).(base_yr_index)...
               (~ismember(varown_vec.(place{cc}).(base_yr_index),varown_vec.(place{cc}).(yr_index_5yr_lag))));
           entrants_surviving5yrs.(place{cc}).(base_yr_index) = entrants_surviving5yrs.(place{cc}).(base_yr_index)(~isnan(entrants_surviving5yrs.(place{cc}).(base_yr_index)));
           share_employment_dom_entrants5yrs.(place{cc})(end+1) = ...
               (sum(firm_output.(place{cc}).(base_yr_index)(entrants_surviving5yrs.(place{cc}).(base_yr_index)))) / ...
               (sum(firm_output.(place{cc}).(base_yr_index)));
           share_jobs_dom_entrants5yrs.(place{cc})(end+1) = ...
               (sum(firm_output.(place{cc}).(base_yr_index)(entrants_surviving5yrs.(place{cc}).(base_yr_index)))) / ...
               ((sum(firm_output.(place{cc}).(yr_index_5yr_lag))+sum(firm_output.(place{cc}).(base_yr_index)))/2);
           share_firms_dom_entrants5yrs.(place{cc}) = share_firms_dom_entrants5yrs.(place{cc}) + ...
              length(entrants_surviving5yrs.(place{cc}).(base_yr_index)) / ...
              (length(unique(varown_vec.(place{cc}).(base_yr_index)(~isnan(varown_vec.(place{cc}).(base_yr_index))))));
          
          % STATISTICS FOR EXITERS
          exiters_1yr.(place{cc}) = unique(varown_vec.(place{cc}).(yr_index_lag)...
              (~ismember(varown_vec.(place{cc}).(yr_index_lag),varown_vec.(place{cc}).(base_yr_index))));
          exiters_1yr.(place{cc}) = exiters_1yr.(place{cc})(~isnan(exiters_1yr.(place{cc})));
          share_employment_exiters_1yr.(place{cc})(end+1) = (sum(firm_output.(place{cc}).(yr_index_lag)(exiters_1yr.(place{cc})))) / ...
              (sum(firm_output.(place{cc}).(yr_index_lag)));
          share_jobs_exiters_1yr.(place{cc})(end+1) = (sum(firm_output.(place{cc}).(yr_index_lag)(exiters_1yr.(place{cc})))) / ...
              ((sum(firm_output.(place{cc}).(yr_index_lag))+sum(firm_output.(place{cc}).(base_yr_index)))/2);
          share_firms_exiters_1yr.(place{cc}) = share_firms_exiters_1yr.(place{cc}) + ...
              length(exiters_1yr.(place{cc})) / ...
              (length(unique(varown_vec.(place{cc}).(yr_index_lag)(~isnan(varown_vec.(place{cc}).(yr_index_lag))))));
          
          exiters_5yr.(place{cc}) = unique(varown_vec.(place{cc}).(yr_index_5yr_lag)...
               (~ismember(varown_vec.(place{cc}).(yr_index_5yr_lag),varown_vec.(place{cc}).(base_yr_index))));
          exiters_5yr.(place{cc}) = exiters_5yr.(place{cc})(~isnan(exiters_5yr.(place{cc})));
          share_employment_exiters_5yr.(place{cc})(end+1) =  ...
               (sum(firm_output.(place{cc}).(yr_index_5yr_lag)(exiters_5yr.(place{cc})))) / ...
               (sum(firm_output.(place{cc}).(yr_index_5yr_lag)));
          share_jobs_exiters_5yr.(place{cc})(end+1) =  ...
               (sum(firm_output.(place{cc}).(yr_index_5yr_lag)(exiters_5yr.(place{cc})))) / ...
               ((sum(firm_output.(place{cc}).(yr_index_5yr_lag))+sum(firm_output.(place{cc}).(base_yr_index)))/2);
          share_firms_exiters_5yr.(place{cc}) = share_firms_exiters_5yr.(place{cc}) + ...
              length(exiters_5yr.(place{cc})) / ...
              (length(unique(varown_vec.(place{cc}).(yr_index_5yr_lag)(~isnan(varown_vec.(place{cc}).(yr_index_5yr_lag))))));
          
          % STATISTICS EXPANDING AND CONTRACTING INCUMBENTS        
          surviving_incumbents.(place{cc}).(base_yr_index) = unique(varown_vec.(place{cc}).(yr_index_lag)(produced.(place{cc}).(yr_index_lag) &...
              ismember(varown_vec.(place{cc}).(yr_index_lag), varown_vec.(place{cc}).(base_yr_index))));
          incumbents_that_expand_1yr.(place{cc}) = surviving_incumbents.(place{cc}).(base_yr_index)(...
              firm_output.(place{cc}).(base_yr_index)(surviving_incumbents.(place{cc}).(base_yr_index)) > ...
              firm_output.(place{cc}).(yr_index_lag)(surviving_incumbents.(place{cc}).(base_yr_index)));
          share_added_output_expanding_incumbents_1yr.(place{cc})(end+1) = ...
              sum(firm_output.(place{cc}).(base_yr_index)(incumbents_that_expand_1yr.(place{cc})) - ...
                    firm_output.(place{cc}).(yr_index_lag)(incumbents_that_expand_1yr.(place{cc}))) / ...
              ((sum(firm_output.(place{cc}).(yr_index_lag))+sum(firm_output.(place{cc}).(base_yr_index)))/2);
          
          surviving_incumbents5yr.(place{cc}).(base_yr_index) = unique(varown_vec.(place{cc}).(yr_index_5yr_lag)(produced.(place{cc}).(yr_index_5yr_lag) &...
              ismember(varown_vec.(place{cc}).(yr_index_5yr_lag), varown_vec.(place{cc}).(base_yr_index))));
          incumbents_that_expand_5yr.(place{cc}) = surviving_incumbents5yr.(place{cc}).(base_yr_index)(...
              firm_output.(place{cc}).(base_yr_index)(surviving_incumbents5yr.(place{cc}).(base_yr_index)) > ...
              firm_output.(place{cc}).(yr_index_5yr_lag)(surviving_incumbents5yr.(place{cc}).(base_yr_index)));
          share_added_output_expanding_incumbents_5yr.(place{cc})(end+1) = ...
              sum(firm_output.(place{cc}).(base_yr_index)(incumbents_that_expand_5yr.(place{cc})) - ...
                    firm_output.(place{cc}).(yr_index_5yr_lag)(incumbents_that_expand_5yr.(place{cc}))) / ...
              ((sum(firm_output.(place{cc}).(yr_index_5yr_lag))+sum(firm_output.(place{cc}).(base_yr_index)))/2);
         
          incumbents_that_contract_1yr.(place{cc}) = surviving_incumbents.(place{cc}).(base_yr_index)(...
              firm_output.(place{cc}).(base_yr_index)(surviving_incumbents.(place{cc}).(base_yr_index)) < ...
              firm_output.(place{cc}).(yr_index_lag)(surviving_incumbents.(place{cc}).(base_yr_index)));
          share_lost_output_contracting_incumbents_1yr.(place{cc})(end+1) = sum(firm_output.(place{cc}).(base_yr_index)(incumbents_that_contract_1yr.(place{cc})) - ...
                    firm_output.(place{cc}).(yr_index_lag)(incumbents_that_contract_1yr.(place{cc}))) / ...
              ((sum(firm_output.(place{cc}).(yr_index_lag))+sum(firm_output.(place{cc}).(base_yr_index)))/2);

          incumbents_that_contract_5yr.(place{cc}) = surviving_incumbents5yr.(place{cc}).(base_yr_index)(...
              firm_output.(place{cc}).(base_yr_index)(surviving_incumbents5yr.(place{cc}).(base_yr_index)) < ...
              firm_output.(place{cc}).(yr_index_5yr_lag)(surviving_incumbents5yr.(place{cc}).(base_yr_index)));
          share_lost_output_contracting_incumbents_5yr.(place{cc})(end+1) = ...
              sum(firm_output.(place{cc}).(base_yr_index)(incumbents_that_contract_5yr.(place{cc})) - ...
                    firm_output.(place{cc}).(yr_index_5yr_lag)(incumbents_that_contract_5yr.(place{cc}))) / ...
              ((sum(firm_output.(place{cc}).(yr_index_5yr_lag))+sum(firm_output.(place{cc}).(base_yr_index)))/2);
          
          % SAME JOB CREATION/DESTRUCTION STATS FOR LARGE FIRMS
          
          large_incumbents_that_contract_1yr.(place{cc}) = surviving_incumbents.(place{cc}).(base_yr_index)(...
              firm_output.(place{cc}).(base_yr_index)(surviving_incumbents.(place{cc}).(base_yr_index)) < ...
              firm_output.(place{cc}).(yr_index_lag)(surviving_incumbents.(place{cc}).(base_yr_index)) & ...
              firm_output.(place{cc}).(yr_index_lag)(surviving_incumbents.(place{cc}).(base_yr_index)) > ...
              mean(firm_output.(place{cc}).(yr_index_lag)(firm_output.(place{cc}).(yr_index_lag)>0)));
          
          share_lost_output_large_incumbents_1yr.(place{cc})(end+1) = sum(firm_output.(place{cc}).(base_yr_index)(large_incumbents_that_contract_1yr.(place{cc})) - ...
                    firm_output.(place{cc}).(yr_index_lag)(large_incumbents_that_contract_1yr.(place{cc}))) / ...
                    ((sum(firm_output.(place{cc}).(yr_index_lag))+sum(firm_output.(place{cc}).(base_yr_index)))/2);
          
          large_incumbents_that_contract_5yr.(place{cc}) = surviving_incumbents5yr.(place{cc}).(base_yr_index)(...
              firm_output.(place{cc}).(base_yr_index)(surviving_incumbents5yr.(place{cc}).(base_yr_index)) < ...
              firm_output.(place{cc}).(yr_index_5yr_lag)(surviving_incumbents5yr.(place{cc}).(base_yr_index)) & ...
              firm_output.(place{cc}).(yr_index_5yr_lag)(surviving_incumbents5yr.(place{cc}).(base_yr_index)) > ...
              mean(firm_output.(place{cc}).(yr_index_5yr_lag)(firm_output.(place{cc}).(yr_index_5yr_lag)>0)));
          
          share_lost_output_large_incumbents_5yr.(place{cc})(end+1) = ...
              sum(firm_output.(place{cc}).(base_yr_index)(large_incumbents_that_contract_5yr.(place{cc})) - ...
                    firm_output.(place{cc}).(yr_index_5yr_lag)(large_incumbents_that_contract_5yr.(place{cc}))) / ...
              ((sum(firm_output.(place{cc}).(yr_index_5yr_lag))+sum(firm_output.(place{cc}).(base_yr_index)))/2);
          
          large_exiters_1yr.(place{cc}) = exiters_1yr.(place{cc})(firm_output.(place{cc}).(yr_index_lag)(exiters_1yr.(place{cc})) > ...
              mean(firm_output.(place{cc}).(yr_index_lag)(firm_output.(place{cc}).(yr_index_lag)>0)));
          share_employment_large_exiters_1yr.(place{cc})(end+1) = (sum(firm_output.(place{cc}).(yr_index_lag)(large_exiters_1yr.(place{cc})))) / ...
              ((sum(firm_output.(place{cc}).(yr_index_lag))+sum(firm_output.(place{cc}).(base_yr_index)))/2);
          
          large_exiters_5yr.(place{cc}) = exiters_5yr.(place{cc})(firm_output.(place{cc}).(yr_index_5yr_lag)(exiters_5yr.(place{cc})) > ...
              mean(firm_output.(place{cc}).(yr_index_5yr_lag)(firm_output.(place{cc}).(yr_index_5yr_lag)>0)));
          share_employment_large_exiters_5yr.(place{cc})(end+1) = (sum(firm_output.(place{cc}).(yr_index_5yr_lag)(large_exiters_5yr.(place{cc})))) / ...
              ((sum(firm_output.(place{cc}).(yr_index_5yr_lag))+sum(firm_output.(place{cc}).(base_yr_index)))/2);
          
          %%% CALCULATE JOB CREATION/DESTRUCTION STATS FOR EXPORTERS
          surviving_exporters.(place{cc}).(base_yr_index) = unique(varown_exports.(place{cc}).(yr_index_lag) &...
              ismember(varown_exports.(place{cc}).(yr_index_lag), varown_exports.(place{cc}).(base_yr_index)));
          surviving_exporters5yr.(place{cc}).(base_yr_index) = unique(varown_exports.(place{cc}).(yr_index_5yr_lag) &...
              ismember(varown_exports.(place{cc}).(yr_index_5yr_lag), varown_exports.(place{cc}).(base_yr_index)));
          
          exporters_that_contract_1yr.(place{cc}) = surviving_exporters.(place{cc}).(base_yr_index)(...
              firm_export_output.(place{cc}).(base_yr_index)(surviving_exporters.(place{cc}).(base_yr_index)) < ...
              firm_export_output.(place{cc}).(yr_index_lag)(surviving_exporters.(place{cc}).(base_yr_index)));
          exporters_that_contract_5yr.(place{cc}) = surviving_exporters5yr.(place{cc}).(base_yr_index)(...
              firm_export_output.(place{cc}).(base_yr_index)(surviving_exporters5yr.(place{cc}).(base_yr_index)) < ...
              firm_export_output.(place{cc}).(yr_index_5yr_lag)(surviving_exporters5yr.(place{cc}).(base_yr_index)));
          
          share_lost_output_contracting_exporters_1yr.(place{cc})(end+1) = sum(firm_export_output.(place{cc}).(base_yr_index)(exporters_that_contract_1yr.(place{cc})) - ...
              firm_export_output.(place{cc}).(yr_index_lag)(exporters_that_contract_1yr.(place{cc}))) / ...
              ((sum(firm_output.(place{cc}).(yr_index_lag))+sum(firm_output.(place{cc}).(base_yr_index)))/2);
          share_lost_output_contracting_exporters_5yr.(place{cc})(end+1) = ...
              sum(firm_export_output.(place{cc}).(base_yr_index)(exporters_that_contract_5yr.(place{cc})) - ...
              firm_export_output.(place{cc}).(yr_index_5yr_lag)(exporters_that_contract_5yr.(place{cc}))) / ...
              ((sum(firm_output.(place{cc}).(yr_index_5yr_lag))+sum(firm_output.(place{cc}).(base_yr_index)))/2);
          
          exporters_that_expand_1yr.(place{cc}) = surviving_exporters.(place{cc}).(base_yr_index)(...
              firm_export_output.(place{cc}).(base_yr_index)(surviving_exporters.(place{cc}).(base_yr_index)) > ...
              firm_export_output.(place{cc}).(yr_index_lag)(surviving_exporters.(place{cc}).(base_yr_index)));
          exporters_that_expand_5yr.(place{cc}) = surviving_exporters5yr.(place{cc}).(base_yr_index)(...
              firm_export_output.(place{cc}).(base_yr_index)(surviving_exporters5yr.(place{cc}).(base_yr_index)) > ...
              firm_export_output.(place{cc}).(yr_index_5yr_lag)(surviving_exporters5yr.(place{cc}).(base_yr_index)));

          share_added_output_expanding_exporters_1yr.(place{cc})(end+1) = sum(firm_export_output.(place{cc}).(base_yr_index)(exporters_that_expand_1yr.(place{cc})) - ...
              firm_export_output.(place{cc}).(yr_index_lag)(exporters_that_expand_1yr.(place{cc}))) / ...
              ((sum(firm_output.(place{cc}).(yr_index_lag))+sum(firm_output.(place{cc}).(base_yr_index)))/2);
          share_added_output_expanding_exporters_5yr.(place{cc})(end+1) = ...
              sum(firm_export_output.(place{cc}).(base_yr_index)(exporters_that_expand_5yr.(place{cc})) - ...
                    firm_export_output.(place{cc}).(yr_index_5yr_lag)(exporters_that_expand_5yr.(place{cc}))) / ...
              ((sum(firm_output.(place{cc}).(yr_index_5yr_lag))+sum(firm_output.(place{cc}).(base_yr_index)))/2);
          
          all_new_exporters_5yr.(place{cc}).(base_yr_index) = exporters.(place{cc}).(base_yr_index)(~ismember(exporters.(place{cc}).(base_yr_index),...
                        exporters.(place{cc}).(yr_index_5yr_lag)));
          all_new_exporters_export_output_5yr.(place{cc}).(base_yr_index) = firm_export_output.(place{cc}).(base_yr_index)(...
                                all_new_exporters_5yr.(place{cc}).(base_yr_index));
          share_output_all_new_exporters_5yr.(place{cc})(end+1) = sum(all_new_exporters_export_output_5yr.(place{cc}).(base_yr_index)) / ...
                                ((sum(firm_output.(place{cc}).(yr_index_5yr_lag))+sum(firm_output.(place{cc}).(base_yr_index)))/2);
          
          all_stopped_exporters_5yr.(place{cc}).(base_yr_index) = exporters.(place{cc}).(yr_index_5yr_lag)(...
                                ~ismember(exporters.(place{cc}).(yr_index_5yr_lag),...
                                    exporters.(place{cc}).(base_yr_index)));
          all_stopped_exporters_export_output_5yr.(place{cc}).(base_yr_index) = firm_export_output.(place{cc}).(yr_index_5yr_lag)(...
                                all_stopped_exporters_5yr.(place{cc}).(base_yr_index));
          share_output_all_stopped_exporters_5yr.(place{cc})(end+1) = sum(all_stopped_exporters_export_output_5yr.(place{cc}).(base_yr_index)) / ...
                                ((sum(firm_output.(place{cc}).(yr_index_5yr_lag))+sum(firm_output.(place{cc}).(base_yr_index)))/2);
                                
          all_new_exporters_export_output.(place{cc}).(base_yr_index) = firm_export_output.(place{cc}).(base_yr_index)(...
                                all_new_exporters.(place{cc}).(base_yr_index));
          share_output_all_new_exporters.(place{cc})(end+1) = sum(all_new_exporters_export_output.(place{cc}).(base_yr_index)) / ...
                                ((sum(firm_output.(place{cc}).(yr_index_lag))+sum(firm_output.(place{cc}).(base_yr_index)))/2);
          all_stopped_exporters_export_output.(place{cc}).(base_yr_index) = firm_export_output.(place{cc}).(yr_index_lag)(...
                                all_stopped_exporters.(place{cc}).(base_yr_index));                   
          share_output_all_stopped_exporters.(place{cc})(end+1) = sum(all_stopped_exporters_export_output.(place{cc}).(base_yr_index)) / ...
                                ((sum(firm_output.(place{cc}).(yr_index_lag))+sum(firm_output.(place{cc}).(base_yr_index)))/2);
          
          replaced_exports_1yr.(place{cc}).(base_yr_index) = logical(exports.(place{cc}).(base_yr_index) & exports.(place{cc}).(yr_index_lag) & ...
              varown_vec.(place{cc}).(base_yr_index) ~= varown_vec.(place{cc}).(yr_index_lag));
          job_creation_exports_variety_level.(place{cc})(end+1) = (sum(output.(place{3-cc}).(base_yr_index)(exports.(place{cc}).(base_yr_index) & ~exports.(place{cc}).(yr_index_lag))) + ...
                + sum(output.(place{3-cc}).(base_yr_index)(replaced_exports_1yr.(place{cc}).(base_yr_index)))) ...
                / ((sum(firm_output.(place{cc}).(yr_index_lag))+sum(firm_output.(place{cc}).(base_yr_index)))/2);
          replaced_exports_5yr.(place{cc}).(base_yr_index) = logical(exports.(place{cc}).(base_yr_index) & exports.(place{cc}).(yr_index_5yr_lag) & ...
              varown_vec.(place{cc}).(base_yr_index) ~= varown_vec.(place{cc}).(yr_index_5yr_lag));
          job_creation_exports_variety_level_5yr.(place{cc})(end+1) = (sum(output.(place{3-cc}).(base_yr_index)(exports.(place{cc}).(base_yr_index) & ~exports.(place{cc}).(yr_index_5yr_lag))) + ...
                + sum(output.(place{3-cc}).(base_yr_index)(replaced_exports_5yr.(place{cc}).(base_yr_index)))) ...
                / ((sum(firm_output.(place{cc}).(yr_index_5yr_lag))+sum(firm_output.(place{cc}).(base_yr_index)))/2);
          
          job_destruction_imports_variety_level.(place{cc})(end+1) = sum(output.(place{cc}).(base_yr_index)(exports.(place{3-cc}).(base_yr_index) & ~exports.(place{3-cc}).(yr_index_lag))) ...
                / ((sum(firm_output.(place{cc}).(yr_index_lag))+sum(firm_output.(place{cc}).(base_yr_index)))/2);
          job_destruction_imports_variety_level_5yr.(place{cc})(end+1) = sum(output.(place{cc}).(base_yr_index)(exports.(place{3-cc}).(base_yr_index) & ~exports.(place{3-cc}).(yr_index_5yr_lag))) ...
                / ((sum(firm_output.(place{cc}).(yr_index_5yr_lag))+sum(firm_output.(place{cc}).(base_yr_index)))/2);
                            
          % EXPORTER REVENUE STATS
          all_new_exporters_export_revenue.(place{cc}).(base_yr_index) = firm_export_revenue.(place{cc}).(base_yr_index)(...
                        all_new_exporters.(place{cc}).(base_yr_index));
          share_export_revenue_all_new_exporters_vec.(place{cc})(end+1) = sum(all_new_exporters_export_revenue.(place{cc}).(base_yr_index)) / ...
                        sum(firm_export_revenue.(place{cc}).(base_yr_index));          
          
          all_new_exporters_export_revenue_5yr.(place{cc}).(base_yr_index) = firm_export_revenue.(place{cc}).(base_yr_index)(...
                        all_new_exporters_5yr.(place{cc}).(base_yr_index));
          share_export_revenue_all_new_exporters_5yr_vec.(place{cc})(end+1) = sum(all_new_exporters_export_revenue_5yr.(place{cc}).(base_yr_index)) / ...
                        sum(firm_export_revenue.(place{cc}).(base_yr_index));
          
          all_stopped_exporters_export_revenue.(place{cc}).(base_yr_index) = firm_export_revenue.(place{cc}).(yr_index_lag)(...
                                all_stopped_exporters.(place{cc}).(base_yr_index));                   
          share_export_revenue_all_stopped_exporters_vec.(place{cc})(end+1) = sum(all_stopped_exporters_export_revenue.(place{cc}).(base_yr_index)) / ...
                                sum(firm_export_revenue.(place{cc}).(yr_index_lag));
          
          all_stopped_exporters_export_revenue_5yr.(place{cc}).(base_yr_index) = firm_export_revenue.(place{cc}).(yr_index_5yr_lag)(...
                                all_stopped_exporters_5yr.(place{cc}).(base_yr_index));
          share_export_revenue_all_stopped_exporters_5yr_vec.(place{cc})(end+1) = sum(all_stopped_exporters_export_revenue_5yr.(place{cc}).(base_yr_index)) / ...
                                sum(firm_export_revenue.(place{cc}).(yr_index_5yr_lag));
           
          % Calculate group export statistics
%           group_export_elasticity_5yr_vec.(place{cc})(end+1) = group_export_share.(place{cc}).(base_yr_index)(leading_export_group.(place{cc}).(yr_index_5yr_lag)) /...
%                                 group_export_share.(place{cc}).(yr_index_5yr_lag)(leading_export_group.(place{cc}).(yr_index_5yr_lag));
                            
          % EXPORT REALLOCATION
           share_lost_exports_1yr.(place{cc})(end+1) = sum(~exports.(place{cc}).(base_yr_index)&exports.(place{cc}).(yr_index_lag))...
               ./sum(exports.(place{cc}).(yr_index_lag));
           share_lost_exports_5yr.(place{cc})(end+1) = sum(~exports.(place{cc}).(base_yr_index)&exports.(place{cc}).(yr_index_5yr_lag))...
               ./sum(exports.(place{cc}).(yr_index_5yr_lag));
        
           % FIRM VOLATILITY STATS
           
           % All the lines that look like this are adding zeros to past
           % year firm vectors to make them the same length for Arctan
           % measure across years
%            firm_revenue.(place{cc}).(yr_index_lag) = [firm_revenue.(place{cc}).(yr_index_lag); zeros(length(firm_revenue.(place{cc}).(base_yr_index))-length(firm_revenue.(place{cc}).(yr_index_lag)),1)];
%            
%            percent_change_firm_revenue.(place{cc}).(base_yr_index) = (firm_revenue.(place{cc}).(base_yr_index) - (firm_revenue.(place{cc}).(yr_index_lag))) ...
%                                         ./ ((firm_revenue.(place{cc}).(base_yr_index) + firm_revenue.(place{cc}).(yr_index_lag)) ./ 2);
%            
%            firm_export_revenue.(place{cc}).(yr_index_lag) = [firm_export_revenue.(place{cc}).(yr_index_lag); zeros(length(firm_export_revenue.(place{cc}).(base_yr_index))-length(firm_export_revenue.(place{cc}).(yr_index_lag)),1)];
%                          
%            percent_change_firm_export_revenue.(place{cc}).(base_yr_index) = (firm_export_revenue.(place{cc}).(base_yr_index) - (firm_export_revenue.(place{cc}).(yr_index_lag))) ...
%                                         ./ ((firm_export_revenue.(place{cc}).(base_yr_index) + firm_export_revenue.(place{cc}).(yr_index_lag)) / 2);
%            
%            firm_domestic_revenue.(place{cc}).(yr_index_lag) = [firm_domestic_revenue.(place{cc}).(yr_index_lag); zeros(length(firm_domestic_revenue.(place{cc}).(base_yr_index))-length(firm_domestic_revenue.(place{cc}).(yr_index_lag)),1)];
%                                    
%            percent_change_firm_domestic_revenue.(place{cc}).(base_yr_index) = (firm_domestic_revenue.(place{cc}).(base_yr_index) - (firm_domestic_revenue.(place{cc}).(yr_index_lag))) ...
%                                         ./ ((firm_domestic_revenue.(place{cc}).(base_yr_index) + firm_domestic_revenue.(place{cc}).(yr_index_lag)) / 2);
%            
%            firm_output.(place{cc}).(yr_index_lag) = [firm_output.(place{cc}).(yr_index_lag); zeros(length(firm_output.(place{cc}).(base_yr_index))-length(firm_output.(place{cc}).(yr_index_lag)),1)];
%                                     
%            percent_change_firm_output.(place{cc}).(base_yr_index) = (firm_output.(place{cc}).(base_yr_index) - (firm_output.(place{cc}).(yr_index_lag))) ...
%                                         ./ ((firm_output.(place{cc}).(base_yr_index) + firm_output.(place{cc}).(yr_index_lag)) ./ 2);
% 
%            firm_export_output.(place{cc}).(yr_index_lag) = [firm_export_output.(place{cc}).(yr_index_lag); zeros(length(firm_export_output.(place{cc}).(base_yr_index))-length(firm_export_output.(place{cc}).(yr_index_lag)),1)];
%            
%            percent_change_firm_export_output.(place{cc}).(base_yr_index) = (firm_export_output.(place{cc}).(base_yr_index) - (firm_export_output.(place{cc}).(yr_index_lag))) ...
%                                         ./ ((firm_export_output.(place{cc}).(base_yr_index) + firm_export_output.(place{cc}).(yr_index_lag)) / 2);
%            
%            firm_domestic_output.(place{cc}).(yr_index_lag) = [firm_domestic_output.(place{cc}).(yr_index_lag); zeros(length(firm_domestic_output.(place{cc}).(base_yr_index))-length(firm_domestic_output.(place{cc}).(yr_index_lag)),1)];
%            
%            percent_change_firm_domestic_output.(place{cc}).(base_yr_index) = (firm_domestic_output.(place{cc}).(base_yr_index) - (firm_domestic_output.(place{cc}).(yr_index_lag))) ...
%                                         ./ ((firm_domestic_output.(place{cc}).(base_yr_index) + firm_domestic_output.(place{cc}).(yr_index_lag)) / 2);
%                                     
%            log_change_firm_revenue.(place{cc}).(base_yr_index) = log(firm_revenue.(place{cc}).(base_yr_index)(surviving_incumbents.(place{cc}).(base_yr_index))) ...
%                                         - log(firm_revenue.(place{cc}).(yr_index_lag)(surviving_incumbents.(place{cc}).(base_yr_index)));
%                                     
%            log_change_firm_output.(place{cc}).(base_yr_index) = log(firm_output.(place{cc}).(base_yr_index)(surviving_incumbents.(place{cc}).(base_yr_index))) ...
%                                         - log(firm_output.(place{cc}).(yr_index_lag)(surviving_incumbents.(place{cc}).(base_yr_index)));
%                                     
%            firm_export_share_surviving_incumbents.(place{cc}).(base_yr_index) = firm_export_share.(place{cc}).(yr_index_lag)(surviving_incumbents.(place{cc}).(base_yr_index));
%            
%            std_export_sales_growth_vec.(place{cc}) = [std_export_sales_growth_vec.(place{cc}); nanstd(percent_change_firm_export_revenue.(place{cc}).(base_yr_index))];
%            std_domestic_sales_growth_vec.(place{cc}) = [std_domestic_sales_growth_vec.(place{cc}); nanstd(percent_change_firm_domestic_revenue.(place{cc}).(base_yr_index))];
%            
%            export_domestic_relative_volatility.(place{cc}) = [export_domestic_relative_volatility.(place{cc}); std_export_sales_growth_vec.(place{cc})(end)/std_domestic_sales_growth_vec.(place{cc})(end)];
%            
%            %%% FIRM VOLATILITY 5 YEAR MEASUREMENT
%            firm_revenue.(place{cc}).(yr_index_5yr_lag) = [firm_revenue.(place{cc}).(yr_index_5yr_lag); zeros(length(firm_revenue.(place{cc}).(base_yr_index))-length(firm_revenue.(place{cc}).(yr_index_5yr_lag)),1)];
%            
%            percent_change_firm_revenue_5yr.(place{cc}).(base_yr_index) = (firm_revenue.(place{cc}).(base_yr_index) - (firm_revenue.(place{cc}).(yr_index_5yr_lag))) ...
%                                         ./ ((firm_revenue.(place{cc}).(base_yr_index) + firm_revenue.(place{cc}).(yr_index_5yr_lag)) ./ 2);
%            
%            firm_export_revenue.(place{cc}).(yr_index_5yr_lag) = [firm_export_revenue.(place{cc}).(yr_index_5yr_lag); zeros(length(firm_export_revenue.(place{cc}).(base_yr_index))-length(firm_export_revenue.(place{cc}).(yr_index_5yr_lag)),1)];
%             
%            firm_export_share.(place{cc}).(yr_index_5yr_lag) = firm_export_revenue.(place{cc}).(yr_index_5yr_lag)./firm_revenue.(place{cc}).(yr_index_5yr_lag);
%            
%            volatility_export_share_bin_1.(place{cc}) = [volatility_export_share_bin_1.(place{cc}); 
%                                         mean((percent_change_firm_revenue_5yr.(place{cc}).(base_yr_index)(firm_export_share.(place{cc}).(yr_index_5yr_lag)>0.001 ...
%                                         &firm_export_share.(place{cc}).(yr_index_5yr_lag)<=0.1)).^2)];
%            volatility_export_share_bin_2.(place{cc}) = [volatility_export_share_bin_2.(place{cc}); 
%                                         mean((percent_change_firm_revenue_5yr.(place{cc}).(base_yr_index)(firm_export_share.(place{cc}).(yr_index_5yr_lag)>0.1 ...
%                                         &firm_export_share.(place{cc}).(yr_index_5yr_lag)<=0.2)).^2)];                         
%            volatility_export_share_bin_3.(place{cc}) = [volatility_export_share_bin_3.(place{cc}); 
%                                         mean((percent_change_firm_revenue_5yr.(place{cc}).(base_yr_index)(firm_export_share.(place{cc}).(yr_index_5yr_lag)>0.2 ...
%                                         &firm_export_share.(place{cc}).(yr_index_5yr_lag)<=0.3)).^2)];
%            volatility_export_share_bin_4.(place{cc}) = [volatility_export_share_bin_4.(place{cc}); 
%                                         mean((percent_change_firm_revenue_5yr.(place{cc}).(base_yr_index)(firm_export_share.(place{cc}).(yr_index_5yr_lag)>0.3 ...
%                                         &firm_export_share.(place{cc}).(yr_index_5yr_lag)<=0.4)).^2)];
%            volatility_export_share_bin_5.(place{cc}) = [volatility_export_share_bin_5.(place{cc}); 
%                                         mean((percent_change_firm_revenue_5yr.(place{cc}).(base_yr_index)(firm_export_share.(place{cc}).(yr_index_5yr_lag)>0.4 ...
%                                         &firm_export_share.(place{cc}).(yr_index_5yr_lag)<=0.5)).^2)];                         
%            volatility_export_share_bin_6.(place{cc}) = [volatility_export_share_bin_6.(place{cc}); 
%                                         mean(percent_change_firm_revenue_5yr.(place{cc}).(base_yr_index)(firm_export_share.(place{cc}).(yr_index_5yr_lag)>0.5).^2)];                                                            
%            
%            percent_change_firm_export_revenue_5yr.(place{cc}).(base_yr_index) = (firm_export_revenue.(place{cc}).(base_yr_index) - (firm_export_revenue.(place{cc}).(yr_index_5yr_lag))) ...
%                                         ./ ((firm_export_revenue.(place{cc}).(base_yr_index) + firm_export_revenue.(place{cc}).(yr_index_5yr_lag)) / 2);
%            
%            firm_export_creation_5yr.(place{cc}).(base_yr_index) = sum(firm_export_revenue.(place{cc}).(base_yr_index)(percent_change_firm_export_revenue_5yr.(place{cc}).(base_yr_index)>0) ...
%                                         - firm_export_revenue.(place{cc}).(yr_index_5yr_lag)(percent_change_firm_export_revenue_5yr.(place{cc}).(base_yr_index)>0)) ...
%                                         ./ ((sum(firm_export_revenue.(place{cc}).(base_yr_index))+sum(firm_export_revenue.(place{cc}).(yr_index_5yr_lag)))/2);
%            
%            firm_export_creation_5yr_vec.(place{cc}) = [firm_export_creation_5yr_vec.(place{cc}); firm_export_creation_5yr.(place{cc}).(base_yr_index)];                        
%                
%            firm_export_destruction_5yr.(place{cc}).(base_yr_index) = sum(firm_export_revenue.(place{cc}).(base_yr_index)(percent_change_firm_export_revenue_5yr.(place{cc}).(base_yr_index)<0) ...
%                                         - firm_export_revenue.(place{cc}).(yr_index_5yr_lag)(percent_change_firm_export_revenue_5yr.(place{cc}).(base_yr_index)<0)) ...
%                                         ./ ((sum(firm_export_revenue.(place{cc}).(base_yr_index))+sum(firm_export_revenue.(place{cc}).(yr_index_5yr_lag)))/2);
%            
%            firm_export_destruction_5yr_vec.(place{cc}) = [firm_export_destruction_5yr_vec.(place{cc}); firm_export_destruction_5yr.(place{cc}).(base_yr_index)];                        
%                                     
%            firm_domestic_revenue.(place{cc}).(yr_index_5yr_lag) = [firm_domestic_revenue.(place{cc}).(yr_index_5yr_lag); zeros(length(firm_domestic_revenue.(place{cc}).(base_yr_index))-length(firm_domestic_revenue.(place{cc}).(yr_index_5yr_lag)),1)];
%                                    
%            percent_change_firm_domestic_revenue_5yr.(place{cc}).(base_yr_index) = (firm_domestic_revenue.(place{cc}).(base_yr_index) - (firm_domestic_revenue.(place{cc}).(yr_index_5yr_lag))) ...
%                                         ./ ((firm_domestic_revenue.(place{cc}).(base_yr_index) + firm_domestic_revenue.(place{cc}).(yr_index_5yr_lag)) / 2); 
%            
%            firm_domestic_creation_5yr.(place{cc}).(base_yr_index) = sum(firm_domestic_revenue.(place{cc}).(base_yr_index)(percent_change_firm_domestic_revenue_5yr.(place{cc}).(base_yr_index)>0) ...
%                                         - firm_domestic_revenue.(place{cc}).(yr_index_5yr_lag)(percent_change_firm_domestic_revenue_5yr.(place{cc}).(base_yr_index)>0)) ...
%                                         ./ ((sum(firm_domestic_revenue.(place{cc}).(base_yr_index))+sum(firm_domestic_revenue.(place{cc}).(yr_index_5yr_lag)))/2);
%            
%            firm_domestic_creation_5yr_vec.(place{cc}) = [firm_domestic_creation_5yr_vec.(place{cc}); firm_domestic_creation_5yr.(place{cc}).(base_yr_index)];                        
%                                      
%            firm_domestic_destruction_5yr.(place{cc}).(base_yr_index) = sum(firm_domestic_revenue.(place{cc}).(base_yr_index)(percent_change_firm_domestic_revenue_5yr.(place{cc}).(base_yr_index)<0) ...
%                                         - firm_domestic_revenue.(place{cc}).(yr_index_5yr_lag)(percent_change_firm_domestic_revenue_5yr.(place{cc}).(base_yr_index)<0)) ...
%                                         ./ ((sum(firm_domestic_revenue.(place{cc}).(base_yr_index))+sum(firm_domestic_revenue.(place{cc}).(yr_index_5yr_lag)))/2);
%            
%            firm_domestic_destruction_5yr_vec.(place{cc}) = [firm_domestic_destruction_5yr_vec.(place{cc}); firm_domestic_destruction_5yr.(place{cc}).(base_yr_index)];                        
%                                     
%            std_export_sales_growth_5yr_vec.(place{cc}) = [std_export_sales_growth_5yr_vec.(place{cc}); nanstd(percent_change_firm_export_revenue_5yr.(place{cc}).(base_yr_index))];
%            std_domestic_sales_growth_5yr_vec.(place{cc}) = [std_domestic_sales_growth_5yr_vec.(place{cc}); nanstd(percent_change_firm_domestic_revenue_5yr.(place{cc}).(base_yr_index))];
%            
%            export_domestic_relative_volatility_5yr.(place{cc}) = [export_domestic_relative_volatility_5yr.(place{cc}); std_export_sales_growth_5yr_vec.(place{cc})(end)/std_domestic_sales_growth_5yr_vec.(place{cc})(end)];
%                                     
%            %%% FIRM VOLATILITY 5 YEAR MEASUREMENT FOR EXPORTERS /
%            %%% NON-EXPORTERS
%            exporters_5yr_measure.(place{cc}).(year_index) = logical(firm_export_revenue.(place{cc}).(yr_index_5yr_lag)>0 | firm_export_revenue.(place{cc}).(base_yr_index)>0);
%            nonexporters_5yr_measure.(place{cc}).(year_index) = logical(logical(firm_revenue.(place{cc}).(yr_index_5yr_lag)>0 | firm_revenue.(place{cc}).(base_yr_index)>0) ...
%                                         .*logical(~firm_export_revenue.(place{cc}).(yr_index_5yr_lag)>0 | ~firm_export_revenue.(place{cc}).(base_yr_index)>0));
%            
%            percent_change_firm_revenue_exporters_5yr.(place{cc}).(base_yr_index) = (firm_revenue.(place{cc}).(base_yr_index)(exporters_5yr_measure.(place{cc}).(year_index)) ...
%                                         - (firm_revenue.(place{cc}).(yr_index_5yr_lag)(exporters_5yr_measure.(place{cc}).(year_index)))) ...
%                                         ./ ((firm_revenue.(place{cc}).(base_yr_index)(exporters_5yr_measure.(place{cc}).(year_index)) ...
%                                         + firm_revenue.(place{cc}).(yr_index_5yr_lag)(exporters_5yr_measure.(place{cc}).(year_index))) ./ 2);
%                         
%            percent_change_firm_export_revenue_exporters_5yr.(place{cc}).(base_yr_index) = (firm_export_revenue.(place{cc}).(base_yr_index)(exporters_5yr_measure.(place{cc}).(year_index)) ...
%                                         - (firm_export_revenue.(place{cc}).(yr_index_5yr_lag)(exporters_5yr_measure.(place{cc}).(year_index)))) ...
%                                         ./ ((firm_export_revenue.(place{cc}).(base_yr_index)(exporters_5yr_measure.(place{cc}).(year_index)) ...
%                                         + firm_export_revenue.(place{cc}).(yr_index_5yr_lag)(exporters_5yr_measure.(place{cc}).(year_index))) / 2);
%                                            
%            percent_change_firm_domestic_revenue_exporters_5yr.(place{cc}).(base_yr_index) = (firm_domestic_revenue.(place{cc}).(base_yr_index)(exporters_5yr_measure.(place{cc}).(year_index)) ...
%                                         - (firm_domestic_revenue.(place{cc}).(yr_index_5yr_lag)(exporters_5yr_measure.(place{cc}).(year_index)))) ...
%                                         ./ ((firm_domestic_revenue.(place{cc}).(base_yr_index)(exporters_5yr_measure.(place{cc}).(year_index)) ...
%                                         + firm_domestic_revenue.(place{cc}).(yr_index_5yr_lag)(exporters_5yr_measure.(place{cc}).(year_index))) / 2); 
%            
%            firm_domestic_creation_exporters_5yr.(place{cc}).(base_yr_index) = sum(firm_domestic_revenue.(place{cc}).(base_yr_index)(exporters_5yr_measure.(place{cc}).(year_index) & percent_change_firm_domestic_revenue_5yr.(place{cc}).(base_yr_index)>0) ...
%                                         - firm_domestic_revenue.(place{cc}).(yr_index_5yr_lag)(exporters_5yr_measure.(place{cc}).(year_index) & percent_change_firm_domestic_revenue_5yr.(place{cc}).(base_yr_index)>0)) ...
%                                         ./ ((sum(firm_domestic_revenue.(place{cc}).(base_yr_index)(exporters_5yr_measure.(place{cc}).(year_index))) ...
%                                         +sum(firm_domestic_revenue.(place{cc}).(yr_index_5yr_lag)(exporters_5yr_measure.(place{cc}).(year_index))))/2);
%            
%            firm_domestic_creation_exporters_5yr_vec.(place{cc}) = [firm_domestic_creation_exporters_5yr_vec.(place{cc}); firm_domestic_creation_exporters_5yr.(place{cc}).(base_yr_index)];                        
%                                      
%            firm_domestic_destruction_exporters_5yr.(place{cc}).(base_yr_index) = sum(firm_domestic_revenue.(place{cc}).(base_yr_index)(exporters_5yr_measure.(place{cc}).(year_index) & percent_change_firm_domestic_revenue_5yr.(place{cc}).(base_yr_index)<0) ...
%                                         - firm_domestic_revenue.(place{cc}).(yr_index_5yr_lag)(exporters_5yr_measure.(place{cc}).(year_index) & percent_change_firm_domestic_revenue_5yr.(place{cc}).(base_yr_index)<0)) ...
%                                         ./ ((sum(firm_domestic_revenue.(place{cc}).(base_yr_index)(exporters_5yr_measure.(place{cc}).(year_index))) ...
%                                         +sum(firm_domestic_revenue.(place{cc}).(yr_index_5yr_lag)(exporters_5yr_measure.(place{cc}).(year_index))))/2);
%            
%            firm_domestic_destruction_exporters_5yr_vec.(place{cc}) = [firm_domestic_destruction_exporters_5yr_vec.(place{cc}); firm_domestic_destruction_exporters_5yr.(place{cc}).(base_yr_index)];                        
%            
%            firm_domestic_creation_nonexporters_5yr.(place{cc}).(base_yr_index) = sum(firm_domestic_revenue.(place{cc}).(base_yr_index)(nonexporters_5yr_measure.(place{cc}).(year_index) & percent_change_firm_domestic_revenue_5yr.(place{cc}).(base_yr_index)>0) ...
%                                         - firm_domestic_revenue.(place{cc}).(yr_index_5yr_lag)(nonexporters_5yr_measure.(place{cc}).(year_index) & percent_change_firm_domestic_revenue_5yr.(place{cc}).(base_yr_index)>0)) ...
%                                         ./ ((sum(firm_domestic_revenue.(place{cc}).(base_yr_index)(nonexporters_5yr_measure.(place{cc}).(year_index))) ...
%                                         +sum(firm_domestic_revenue.(place{cc}).(yr_index_5yr_lag)(nonexporters_5yr_measure.(place{cc}).(year_index))))/2);
%            
%            firm_domestic_creation_nonexporters_5yr_vec.(place{cc}) = [firm_domestic_creation_nonexporters_5yr_vec.(place{cc}); firm_domestic_creation_nonexporters_5yr.(place{cc}).(base_yr_index)];                        
%                                      
%            firm_domestic_destruction_nonexporters_5yr.(place{cc}).(base_yr_index) = sum(firm_domestic_revenue.(place{cc}).(base_yr_index)(nonexporters_5yr_measure.(place{cc}).(year_index) & percent_change_firm_domestic_revenue_5yr.(place{cc}).(base_yr_index)<0) ...
%                                         - firm_domestic_revenue.(place{cc}).(yr_index_5yr_lag)(nonexporters_5yr_measure.(place{cc}).(year_index) & percent_change_firm_domestic_revenue_5yr.(place{cc}).(base_yr_index)<0)) ...
%                                         ./ ((sum(firm_domestic_revenue.(place{cc}).(base_yr_index)(nonexporters_5yr_measure.(place{cc}).(year_index))) ...
%                                         +sum(firm_domestic_revenue.(place{cc}).(yr_index_5yr_lag)(nonexporters_5yr_measure.(place{cc}).(year_index))))/2);
%            
%            firm_domestic_destruction_nonexporters_5yr_vec.(place{cc}) = [firm_domestic_destruction_nonexporters_5yr_vec.(place{cc}); firm_domestic_destruction_nonexporters_5yr.(place{cc}).(base_yr_index)];                        
%              
%            std_export_sales_growth_exporters_5yr_vec.(place{cc}) = [std_export_sales_growth_exporters_5yr_vec.(place{cc}); nanstd(percent_change_firm_export_revenue_5yr.(place{cc}).(base_yr_index)(exporters_5yr_measure.(place{cc}).(year_index)))];
%            std_domestic_sales_growth_exporters_5yr_vec.(place{cc}) = [std_domestic_sales_growth_exporters_5yr_vec.(place{cc}); nanstd(percent_change_firm_domestic_revenue_5yr.(place{cc}).(base_yr_index)(exporters_5yr_measure.(place{cc}).(year_index)))];
%            
%            export_domestic_relative_volatility_exporters_5yr.(place{cc}) = [export_domestic_relative_volatility_exporters_5yr.(place{cc}); std_export_sales_growth_exporters_5yr_vec.(place{cc})(end)/std_domestic_sales_growth_exporters_5yr_vec.(place{cc})(end)];
%               
%            %%% VOLATILITY CONDITIONAL ON CONTRACTING
%            std_export_sales_growth_contracting_vec.(place{cc}) = [std_export_sales_growth_contracting_vec.(place{cc}); ...
%                                         nanstd(percent_change_firm_export_revenue.(place{cc}).(base_yr_index)(percent_change_firm_export_revenue.(place{cc}).(base_yr_index)<0))];
%            std_domestic_sales_growth_contracting_vec.(place{cc}) = [std_domestic_sales_growth_contracting_vec.(place{cc}); ...
%                                         nanstd(percent_change_firm_domestic_revenue.(place{cc}).(base_yr_index)(percent_change_firm_domestic_revenue.(place{cc}).(base_yr_index)<0))];
%            
%            export_domestic_relative_volatility_contracting.(place{cc}) = [export_domestic_relative_volatility_contracting.(place{cc}); ...
%                                         std_export_sales_growth_contracting_vec.(place{cc})(end)/std_domestic_sales_growth_contracting_vec.(place{cc})(end)];
%            
%            %%% VOLATILITY CONDITIONAL ON EXPANDING
%            std_export_sales_growth_expanding_vec.(place{cc}) = [std_export_sales_growth_vec.(place{cc}); ...
%                                         nanstd(percent_change_firm_export_revenue.(place{cc}).(base_yr_index)(percent_change_firm_export_revenue.(place{cc}).(base_yr_index)>0))];
%            std_domestic_sales_growth_expanding_vec.(place{cc}) = [std_domestic_sales_growth_vec.(place{cc}); ...
%                                         nanstd(percent_change_firm_domestic_revenue.(place{cc}).(base_yr_index)(percent_change_firm_domestic_revenue.(place{cc}).(base_yr_index)>0))];
%            
%            export_domestic_relative_volatility_expanding.(place{cc}) = [export_domestic_relative_volatility_expanding.(place{cc}); ...
%                                         std_export_sales_growth_expanding_vec.(place{cc})(end)/std_domestic_sales_growth_expanding_vec.(place{cc})(end)];
%            
%            
%            %%% SURVIVING INCUMBENTS RELATIVE EXPORT VOLATILITY
%            percent_change_firm_export_revenue_surviving_incumbents.(place{cc}).(base_yr_index) = (firm_export_revenue.(place{cc}).(base_yr_index)(surviving_incumbents.(place{cc}).(base_yr_index)) ...
%                                         - firm_export_revenue.(place{cc}).(yr_index_lag)(surviving_incumbents.(place{cc}).(base_yr_index))) ...
%                                         ./ ((firm_export_revenue.(place{cc}).(base_yr_index)(surviving_incumbents.(place{cc}).(base_yr_index)) ...
%                                         + firm_export_revenue.(place{cc}).(yr_index_lag)(surviving_incumbents.(place{cc}).(base_yr_index))) / 2);
%           
%            percent_change_firm_domestic_revenue_surviving_incumbents.(place{cc}).(base_yr_index) = (firm_domestic_revenue.(place{cc}).(base_yr_index)(surviving_incumbents.(place{cc}).(base_yr_index)) ...
%                                         - firm_domestic_revenue.(place{cc}).(yr_index_lag)(surviving_incumbents.(place{cc}).(base_yr_index))) ...
%                                         ./ ((firm_domestic_revenue.(place{cc}).(base_yr_index)(surviving_incumbents.(place{cc}).(base_yr_index)) ...
%                                         + firm_domestic_revenue.(place{cc}).(yr_index_lag)(surviving_incumbents.(place{cc}).(base_yr_index))) / 2);
%            
%            std_export_sales_growth_surviving_incumbents_vec.(place{cc}) = [std_export_sales_growth_surviving_incumbents_vec.(place{cc}); nanstd(percent_change_firm_export_revenue_surviving_incumbents.(place{cc}).(base_yr_index))];
%            std_domestic_sales_growth_surviving_incumbents_vec.(place{cc}) = [std_domestic_sales_growth_surviving_incumbents_vec.(place{cc}); nanstd(percent_change_firm_domestic_revenue_surviving_incumbents.(place{cc}).(base_yr_index))];
%                                     
%            export_domestic_relative_volatility_surviving_incumbents.(place{cc}) = [export_domestic_relative_volatility_surviving_incumbents.(place{cc}); ...
%                                         std_export_sales_growth_surviving_incumbents_vec.(place{cc})(end)/std_domestic_sales_growth_surviving_incumbents_vec.(place{cc})(end)];
%            
%                             
%            %%% REGRESSION WITH SIZE CONTROL
%            stacked_domestic_export_sales_growth_squared.(place{cc}).(base_yr_index) = [percent_change_firm_domestic_revenue.(place{cc}).(base_yr_index)(~isnan(percent_change_firm_domestic_revenue.(place{cc}).(base_yr_index))).^2; ...
%                                         percent_change_firm_export_revenue.(place{cc}).(base_yr_index)(~isnan(percent_change_firm_export_revenue.(place{cc}).(base_yr_index))).^2];
%            
%            demeaned_domestic_sales.(place{cc}).(base_yr_index) = log((firm_domestic_revenue.(place{cc}).(base_yr_index)(~isnan(percent_change_firm_domestic_revenue.(place{cc}).(base_yr_index))) ...
%                                         + firm_domestic_revenue.(place{cc}).(yr_index_lag)(~isnan(percent_change_firm_domestic_revenue.(place{cc}).(base_yr_index))))/2) ...
%                                         - mean(log((firm_domestic_revenue.(place{cc}).(base_yr_index)(~isnan(percent_change_firm_domestic_revenue.(place{cc}).(base_yr_index))) ...
%                                         + firm_domestic_revenue.(place{cc}).(yr_index_lag)(~isnan(percent_change_firm_domestic_revenue.(place{cc}).(base_yr_index))))/2));
%                                     
%            demeaned_export_sales.(place{cc}).(base_yr_index) = log((firm_export_revenue.(place{cc}).(base_yr_index)(~isnan(percent_change_firm_export_revenue.(place{cc}).(base_yr_index))) ...
%                                         + firm_export_revenue.(place{cc}).(yr_index_lag)(~isnan(percent_change_firm_export_revenue.(place{cc}).(base_yr_index))))/2) ...
%                                         - mean(log((firm_export_revenue.(place{cc}).(base_yr_index)(~isnan(percent_change_firm_export_revenue.(place{cc}).(base_yr_index))) ...
%                                         + firm_export_revenue.(place{cc}).(yr_index_lag)(~isnan(percent_change_firm_export_revenue.(place{cc}).(base_yr_index))))/2));
%                                     
%            stacked_demeaned_domestic_export_sales.(place{cc}).(base_yr_index) = [demeaned_domestic_sales.(place{cc}).(base_yr_index); demeaned_export_sales.(place{cc}).(base_yr_index)];
%                
%            stacked_domestic_indicators.(place{cc}).(base_yr_index) = [ones(length(demeaned_domestic_sales.(place{cc}).(base_yr_index)),1); zeros(length(demeaned_export_sales.(place{cc}).(base_yr_index)),1)];
%            
%            stacked_export_indicators.(place{cc}).(base_yr_index) = [zeros(length(demeaned_domestic_sales.(place{cc}).(base_yr_index)),1); ones(length(demeaned_export_sales.(place{cc}).(base_yr_index)),1)];
%            
%            independent_variables_mat.(place{cc}).(base_yr_index) = [stacked_demeaned_domestic_export_sales.(place{cc}).(base_yr_index) ...
%                                         stacked_domestic_indicators.(place{cc}).(base_yr_index) stacked_export_indicators.(place{cc}).(base_yr_index)];
%            
%            export_volatility_regression_coefficients.(place{cc}).(base_yr_index) = regress(stacked_domestic_export_sales_growth_squared.(place{cc}).(base_yr_index),independent_variables_mat.(place{cc}).(base_yr_index));
%            
%            export_volatility_regression_sales_coefficient_vec.(place{cc}) = [export_volatility_regression_sales_coefficient_vec.(place{cc}); ...
%                                         export_volatility_regression_coefficients.(place{cc}).(base_yr_index)(1)];
%                                     
%            export_volatility_regression_domestic_indicator_coefficient_vec.(place{cc}) = [export_volatility_regression_domestic_indicator_coefficient_vec.(place{cc}); ...
%                                         export_volatility_regression_coefficients.(place{cc}).(base_yr_index)(2)];
%                                     
%            export_volatility_regression_export_indicator_coefficient_vec.(place{cc}) = [export_volatility_regression_export_indicator_coefficient_vec.(place{cc}); ...
%                                         export_volatility_regression_coefficients.(place{cc}).(base_yr_index)(3)];      
%                                     
%            %%% REGRESSION WITH SIZE CONTROL - 5 YEAR                          
%            stacked_domestic_export_sales_growth_squared_5yr.(place{cc}).(base_yr_index) = [percent_change_firm_domestic_revenue_5yr.(place{cc}).(base_yr_index)(~isnan(percent_change_firm_domestic_revenue_5yr.(place{cc}).(base_yr_index))).^2; ...
%                                         percent_change_firm_export_revenue_5yr.(place{cc}).(base_yr_index)(~isnan(percent_change_firm_export_revenue_5yr.(place{cc}).(base_yr_index))).^2];
%            
%            demeaned_domestic_sales_5yr.(place{cc}).(base_yr_index) = log((firm_domestic_revenue.(place{cc}).(base_yr_index)(~isnan(percent_change_firm_domestic_revenue_5yr.(place{cc}).(base_yr_index))) ...
%                                         + firm_domestic_revenue.(place{cc}).(yr_index_5yr_lag)(~isnan(percent_change_firm_domestic_revenue_5yr.(place{cc}).(base_yr_index))))/2) ...
%                                         - mean(log((firm_domestic_revenue.(place{cc}).(base_yr_index)(~isnan(percent_change_firm_domestic_revenue_5yr.(place{cc}).(base_yr_index))) ...
%                                         + firm_domestic_revenue.(place{cc}).(yr_index_5yr_lag)(~isnan(percent_change_firm_domestic_revenue_5yr.(place{cc}).(base_yr_index))))/2));
%                                     
%            demeaned_export_sales_5yr.(place{cc}).(base_yr_index) = log((firm_export_revenue.(place{cc}).(base_yr_index)(~isnan(percent_change_firm_export_revenue_5yr.(place{cc}).(base_yr_index))) ...
%                                         + firm_export_revenue.(place{cc}).(yr_index_5yr_lag)(~isnan(percent_change_firm_export_revenue_5yr.(place{cc}).(base_yr_index))))/2) ...
%                                         - mean(log((firm_export_revenue.(place{cc}).(base_yr_index)(~isnan(percent_change_firm_export_revenue_5yr.(place{cc}).(base_yr_index))) ...
%                                         + firm_export_revenue.(place{cc}).(yr_index_5yr_lag)(~isnan(percent_change_firm_export_revenue_5yr.(place{cc}).(base_yr_index))))/2));
%                                     
%            stacked_demeaned_domestic_export_sales_5yr.(place{cc}).(base_yr_index) = [demeaned_domestic_sales_5yr.(place{cc}).(base_yr_index); demeaned_export_sales_5yr.(place{cc}).(base_yr_index)];
%                
%            stacked_domestic_indicators_5yr.(place{cc}).(base_yr_index) = [ones(length(demeaned_domestic_sales_5yr.(place{cc}).(base_yr_index)),1); zeros(length(demeaned_export_sales_5yr.(place{cc}).(base_yr_index)),1)];
%            
%            stacked_export_indicators_5yr.(place{cc}).(base_yr_index) = [zeros(length(demeaned_domestic_sales_5yr.(place{cc}).(base_yr_index)),1); ones(length(demeaned_export_sales_5yr.(place{cc}).(base_yr_index)),1)];
%            
%            independent_variables_mat_5yr.(place{cc}).(base_yr_index) = [stacked_demeaned_domestic_export_sales_5yr.(place{cc}).(base_yr_index) ...
%                                         stacked_domestic_indicators_5yr.(place{cc}).(base_yr_index) stacked_export_indicators_5yr.(place{cc}).(base_yr_index)];
%            
%            export_volatility_regression_coefficients_5yr.(place{cc}).(base_yr_index) = regress(stacked_domestic_export_sales_growth_squared_5yr.(place{cc}).(base_yr_index),independent_variables_mat_5yr.(place{cc}).(base_yr_index));
%            
%            export_volatility_regression_sales_coef_5yr_vec.(place{cc}) = [export_volatility_regression_sales_coef_5yr_vec.(place{cc}); ...
%                                         export_volatility_regression_coefficients_5yr.(place{cc}).(base_yr_index)(1)];
%                                     
%            export_volatility_regression_domestic_indicator_coef_5yr_vec.(place{cc}) = [export_volatility_regression_domestic_indicator_coef_5yr_vec.(place{cc}); ...
%                                         export_volatility_regression_coefficients_5yr.(place{cc}).(base_yr_index)(2)];
%                                     
%            export_volatility_regression_export_indicator_coef_5yr_vec.(place{cc}) = [export_volatility_regression_export_indicator_coef_5yr_vec.(place{cc}); ...
%                                         export_volatility_regression_coefficients_5yr.(place{cc}).(base_yr_index)(3)];      
%                                     
%             %%% REGRESSION WITH SIZE CONTROL FOR EXPORTERS - 5 YEAR                          
%            stacked_domestic_export_sales_growth_exporters_squared_5yr.(place{cc}).(base_yr_index) = [percent_change_firm_domestic_revenue_5yr.(place{cc}).(base_yr_index)(exporters_5yr_measure.(place{cc}).(year_index) & ~isnan(percent_change_firm_domestic_revenue_5yr.(place{cc}).(base_yr_index))).^2; ...
%                                         percent_change_firm_export_revenue_5yr.(place{cc}).(base_yr_index)(exporters_5yr_measure.(place{cc}).(year_index) & ~isnan(percent_change_firm_export_revenue_5yr.(place{cc}).(base_yr_index))).^2];
%            
%            demeaned_domestic_sales_exporters_5yr.(place{cc}).(base_yr_index) = log((firm_domestic_revenue.(place{cc}).(base_yr_index)(exporters_5yr_measure.(place{cc}).(year_index) & ~isnan(percent_change_firm_domestic_revenue_5yr.(place{cc}).(base_yr_index))) ...
%                                         + firm_domestic_revenue.(place{cc}).(yr_index_5yr_lag)(exporters_5yr_measure.(place{cc}).(year_index) & ~isnan(percent_change_firm_domestic_revenue_5yr.(place{cc}).(base_yr_index))))/2) ...
%                                         - mean(log((firm_domestic_revenue.(place{cc}).(base_yr_index)(exporters_5yr_measure.(place{cc}).(year_index) & ~isnan(percent_change_firm_domestic_revenue_5yr.(place{cc}).(base_yr_index))) ...
%                                         + firm_domestic_revenue.(place{cc}).(yr_index_5yr_lag)(exporters_5yr_measure.(place{cc}).(year_index) & ~isnan(percent_change_firm_domestic_revenue_5yr.(place{cc}).(base_yr_index))))/2));
%                                     
%            demeaned_export_sales_exporters_5yr.(place{cc}).(base_yr_index) = log((firm_export_revenue.(place{cc}).(base_yr_index)(exporters_5yr_measure.(place{cc}).(year_index) & ~isnan(percent_change_firm_export_revenue_5yr.(place{cc}).(base_yr_index))) ...
%                                         + firm_export_revenue.(place{cc}).(yr_index_5yr_lag)(exporters_5yr_measure.(place{cc}).(year_index) & ~isnan(percent_change_firm_export_revenue_5yr.(place{cc}).(base_yr_index))))/2) ...
%                                         - mean(log((firm_export_revenue.(place{cc}).(base_yr_index)(exporters_5yr_measure.(place{cc}).(year_index) & ~isnan(percent_change_firm_export_revenue_5yr.(place{cc}).(base_yr_index))) ...
%                                         + firm_export_revenue.(place{cc}).(yr_index_5yr_lag)(exporters_5yr_measure.(place{cc}).(year_index) & ~isnan(percent_change_firm_export_revenue_5yr.(place{cc}).(base_yr_index))))/2));
%                                              
%            stacked_demeaned_domestic_export_sales_exporters_5yr.(place{cc}).(base_yr_index) = [demeaned_domestic_sales_exporters_5yr.(place{cc}).(base_yr_index); demeaned_export_sales_exporters_5yr.(place{cc}).(base_yr_index)];
%                
%            stacked_domestic_indicators_exporters_5yr.(place{cc}).(base_yr_index) = [ones(length(demeaned_domestic_sales_exporters_5yr.(place{cc}).(base_yr_index)),1); zeros(length(demeaned_export_sales_exporters_5yr.(place{cc}).(base_yr_index)),1)];
%            
%            stacked_export_indicators_exporters_5yr.(place{cc}).(base_yr_index) = [zeros(length(demeaned_domestic_sales_exporters_5yr.(place{cc}).(base_yr_index)),1); ones(length(demeaned_export_sales_exporters_5yr.(place{cc}).(base_yr_index)),1)];
%            
%            independent_variables_exporters_mat_5yr.(place{cc}).(base_yr_index) = [stacked_demeaned_domestic_export_sales_exporters_5yr.(place{cc}).(base_yr_index) ...
%                                         stacked_domestic_indicators_exporters_5yr.(place{cc}).(base_yr_index) stacked_export_indicators_exporters_5yr.(place{cc}).(base_yr_index)];
%            
%            export_volatility_regression_coefficients_exporters_5yr.(place{cc}).(base_yr_index) = regress(stacked_domestic_export_sales_growth_exporters_squared_5yr.(place{cc}).(base_yr_index),independent_variables_exporters_mat_5yr.(place{cc}).(base_yr_index));
%            
%            export_volatility_regression_sales_coef_exporters_5yr_vec.(place{cc}) = [export_volatility_regression_sales_coef_exporters_5yr_vec.(place{cc}); ...
%                                         export_volatility_regression_coefficients_exporters_5yr.(place{cc}).(base_yr_index)(1)];
%                                     
%            export_volatility_regression_dom_ind_coef_exporters_5yr_vec.(place{cc}) = [export_volatility_regression_dom_ind_coef_exporters_5yr_vec.(place{cc}); ...
%                                         export_volatility_regression_coefficients_exporters_5yr.(place{cc}).(base_yr_index)(2)];
%                                     
%            export_volatility_regression_exp_ind_coef_exporters_5yr_vec.(place{cc}) = [export_volatility_regression_exp_ind_coef_exporters_5yr_vec.(place{cc}); ...
%                                         export_volatility_regression_coefficients_exporters_5yr.(place{cc}).(base_yr_index)(3)];  
%             
%            %%% REGRESSION WITH INTERACTED SIZE CONTROL FOR EXPORTERS - 5 YEAR      
%            stacked_demeaned_domestic_sales_exporters_5yr.(place{cc}).(base_yr_index) = [demeaned_domestic_sales_exporters_5yr.(place{cc}).(base_yr_index); zeros(length(demeaned_export_sales_exporters_5yr.(place{cc}).(base_yr_index)),1)];
%            stacked_demeaned_export_sales_exporters_5yr.(place{cc}).(base_yr_index) = [zeros(length(demeaned_domestic_sales_exporters_5yr.(place{cc}).(base_yr_index)),1); demeaned_export_sales_exporters_5yr.(place{cc}).(base_yr_index)];
%            
%            independent_variables_exporters_int_mat_5yr.(place{cc}).(base_yr_index) = [stacked_demeaned_domestic_sales_exporters_5yr.(place{cc}).(base_yr_index) stacked_demeaned_export_sales_exporters_5yr.(place{cc}).(base_yr_index) ...
%                                         stacked_domestic_indicators_exporters_5yr.(place{cc}).(base_yr_index) stacked_export_indicators_exporters_5yr.(place{cc}).(base_yr_index)];
% 
%            export_volatility_regression_coefficients_int_exporters_5yr.(place{cc}).(base_yr_index) = regress(stacked_domestic_export_sales_growth_exporters_squared_5yr.(place{cc}).(base_yr_index),independent_variables_exporters_int_mat_5yr.(place{cc}).(base_yr_index));
%            
%            export_volatility_regression_dsales_coef_int_exporters_5yr_vec.(place{cc}) = [export_volatility_regression_dsales_coef_int_exporters_5yr_vec.(place{cc}); ...
%                                         export_volatility_regression_coefficients_int_exporters_5yr.(place{cc}).(base_yr_index)(1)];
%                                     
%            export_volatility_regression_esales_coef_int_exporters_5yr_vec.(place{cc}) = [export_volatility_regression_esales_coef_int_exporters_5yr_vec.(place{cc}); ...
%                                         export_volatility_regression_coefficients_int_exporters_5yr.(place{cc}).(base_yr_index)(2)];
%                                     
%            export_volatility_regression_dom_ind_coef_int_exporters_5yr_vec.(place{cc}) = [export_volatility_regression_dom_ind_coef_int_exporters_5yr_vec.(place{cc}); ...
%                                         export_volatility_regression_coefficients_int_exporters_5yr.(place{cc}).(base_yr_index)(3)];
%                                     
%            export_volatility_regression_exp_ind_coef_int_exporters_5yr_vec.(place{cc}) = [export_volatility_regression_exp_ind_coef_int_exporters_5yr_vec.(place{cc}); ...
%                                         export_volatility_regression_coefficients_int_exporters_5yr.(place{cc}).(base_yr_index)(4)];                         
      end

end

% EXPORT VOLATILITY
% std_export_sales_growth_avg.US = mean(std_export_sales_growth_vec.US(end-99:end));
% std_domestic_sales_growth_avg.US = mean(std_domestic_sales_growth_vec.US(end-99:end));
% export_domestic_relative_volatility_avg.US = mean(export_domestic_relative_volatility.US(end-99:end));
% 
% std_export_sales_growth_avg.OECD = mean(std_export_sales_growth_vec.OECD(end-99:end));
% std_domestic_sales_growth_avg.OECD = mean(std_domestic_sales_growth_vec.OECD(end-99:end));
% export_domestic_relative_volatility_avg.OECD = mean(export_domestic_relative_volatility.OECD(end-99:end));
% 
% std_export_sales_growth_5yr_avg.US = mean(std_export_sales_growth_5yr_vec.US(end-99:end));
% std_domestic_sales_growth_5yr_avg.US = mean(std_domestic_sales_growth_5yr_vec.US(end-99:end));
% export_domestic_relative_volatility_5yr_avg.US = mean(export_domestic_relative_volatility_5yr.US(end-99:end));
% 
% std_export_sales_growth_5yr_avg.OECD = mean(std_export_sales_growth_5yr_vec.OECD(end-99:end));
% std_domestic_sales_growth_5yr_avg.OECD = mean(std_domestic_sales_growth_5yr_vec.OECD(end-99:end));
% export_domestic_relative_volatility_5yr_avg.OECD = mean(export_domestic_relative_volatility_5yr.OECD(end-99:end));
% 
% export_domestic_relative_volatility_surviving_incumbents_avg.US = mean(export_domestic_relative_volatility_surviving_incumbents.US(end-99:end));
% export_domestic_relative_volatility_surviving_incumbents_avg.OECD = mean(export_domestic_relative_volatility_surviving_incumbents.OECD(end-99:end));
% 
% export_domestic_relative_volatility_expanding_avg.US = mean(export_domestic_relative_volatility_expanding.US(end-99:end));
% export_domestic_relative_volatility_expanding_avg.OECD = mean(export_domestic_relative_volatility_expanding.OECD(end-99:end));
% 
% export_domestic_relative_volatility_contracting_avg.US = mean(export_domestic_relative_volatility_contracting.US(end-99:end));
% export_domestic_relative_volatility_contracting_avg.OECD = mean(export_domestic_relative_volatility_contracting.OECD(end-99:end));
% 
% export_volatility_regression_sales_coefficient_avg.US = mean(export_volatility_regression_sales_coefficient_vec.US(end-99:end));
% export_volatility_regression_sales_coefficient_avg.OECD = mean(export_volatility_regression_sales_coefficient_vec.OECD(end-99:end));
% 
% export_volatility_regression_domestic_indicator_coefficient_avg.US = mean(export_volatility_regression_domestic_indicator_coefficient_vec.US(end-99:end));
% export_volatility_regression_domestic_indicator_coefficient_avg.OECD = mean(export_volatility_regression_domestic_indicator_coefficient_vec.OECD(end-99:end));
% 
% export_volatility_regression_export_indicator_coefficient_avg.US = mean(export_volatility_regression_export_indicator_coefficient_vec.US(end-99:end));
% export_volatility_regression_export_indicator_coefficient_avg.OECD = mean(export_volatility_regression_export_indicator_coefficient_vec.OECD(end-99:end));
% 
% export_volatility_regression_sales_coef_5yr_avg.US = mean(export_volatility_regression_sales_coef_5yr_vec.US(end-99:end));
% export_volatility_regression_sales_coef_5yr_avg.OECD = mean(export_volatility_regression_sales_coef_5yr_vec.OECD(end-99:end));
% 
% export_volatility_regression_domestic_indicator_coef_5yr_avg.US = mean(export_volatility_regression_domestic_indicator_coef_5yr_vec.US(end-99:end));
% export_volatility_regression_domestic_indicator_coef_5yr_avg.OECD = mean(export_volatility_regression_domestic_indicator_coef_5yr_vec.OECD(end-99:end));
% 
% export_volatility_regression_export_indicator_coef_5yr_avg.US = mean(export_volatility_regression_export_indicator_coef_5yr_vec.US(end-99:end));
% export_volatility_regression_export_indicator_coef_5yr_avg.OECD = mean(export_volatility_regression_export_indicator_coef_5yr_vec.OECD(end-99:end));
% 
% firm_export_creation_5yr_avg.US = mean(firm_export_creation_5yr_vec.US(end-99:end));
% firm_export_destruction_5yr_avg.US = mean(firm_export_destruction_5yr_vec.US(end-99:end));
% firm_export_creation_destruction_avg.US = mean([firm_export_creation_5yr_avg.US, -firm_export_destruction_5yr_avg.US]);
% firm_domestic_creation_5yr_avg.US = mean(firm_domestic_creation_5yr_vec.US(end-99:end));
% firm_domestic_destruction_5yr_avg.US = mean(firm_domestic_destruction_5yr_vec.US(end-99:end));
% firm_domestic_creation_destruction_avg.US = mean([firm_domestic_creation_5yr_avg.US, -firm_domestic_destruction_5yr_avg.US]);
% 
% firm_export_creation_5yr_avg.OECD = mean(firm_export_creation_5yr_vec.OECD(end-99:end));
% firm_export_destruction_5yr_avg.OECD = mean(firm_export_destruction_5yr_vec.OECD(end-99:end));
% firm_domestic_creation_5yr_avg.OECD = mean(firm_domestic_creation_5yr_vec.OECD(end-99:end));
% firm_domestic_destruction_5yr_avg.OECD = mean(firm_domestic_destruction_5yr_vec.OECD(end-99:end));
% 
%  std_export_sales_growth_exporters_5yr_avg.US = mean(std_export_sales_growth_exporters_5yr_vec.US(end-99:end));
%  std_domestic_sales_growth_exporters_5yr_avg.US = mean(std_domestic_sales_growth_exporters_5yr_vec.US(end-99:end));
%  export_domestic_relative_volatility_exporters_5yr_avg.US = mean(export_domestic_relative_volatility_exporters_5yr.US(end-99:end));
% 
%  firm_domestic_creation_exporters_5yr_avg.US = mean(firm_domestic_creation_exporters_5yr_vec.US(end-99:end));
%  firm_domestic_destruction_exporters_5yr_avg.US = mean(firm_domestic_destruction_exporters_5yr_vec.US(end-99:end));
%  firm_domestic_creation_destruction_exporters_5yr_avg.US = mean([firm_domestic_creation_exporters_5yr_avg.US, -firm_domestic_destruction_exporters_5yr_avg.US]);
%  firm_domestic_creation_nonexporters_5yr_avg.US = mean(firm_domestic_creation_nonexporters_5yr_vec.US(end-99:end));
%  firm_domestic_destruction_nonexporters_5yr_avg.US = mean(firm_domestic_destruction_nonexporters_5yr_vec.US(end-99:end));
%  firm_domestic_creation_destruction_nonexporters_5yr_avg.US = mean([firm_domestic_creation_nonexporters_5yr_avg.US, -firm_domestic_destruction_nonexporters_5yr_avg.US]);
%  
%  export_volatility_regression_sales_coef_5yr_avg.US = mean(export_volatility_regression_sales_coef_5yr_vec.US(end-99:end));
%  export_volatility_regression_domestic_indicator_coef_5yr_avg.US = mean(export_volatility_regression_domestic_indicator_coef_5yr_vec.US(end-99:end));
%  export_volatility_regression_export_indicator_coef_5yr_avg.US = mean(export_volatility_regression_export_indicator_coef_5yr_vec.US(end-99:end));  
%  export_volatility_regression_coef_ratio_5yr_avg.US = export_volatility_regression_export_indicator_coef_5yr_avg.US/export_volatility_regression_domestic_indicator_coef_5yr_avg.US;
%  
%  export_volatility_regression_sales_coef_exporters_5yr_avg.US = mean(export_volatility_regression_sales_coef_exporters_5yr_vec.US(end-99:end));   
%  export_volatility_regression_dom_ind_coef_exporters_5yr_avg.US = mean(export_volatility_regression_dom_ind_coef_exporters_5yr_vec.US(end-99:end));
%  export_volatility_regression_exp_ind_coef_exporters_5yr_avg.US = mean(export_volatility_regression_exp_ind_coef_exporters_5yr_vec.US(end-99:end));
%  export_volatility_regression_coef_ratio_exporters_5yr_avg.US = export_volatility_regression_exp_ind_coef_exporters_5yr_avg.US/export_volatility_regression_dom_ind_coef_exporters_5yr_avg.US;
%  
%  export_volatility_regression_dsales_coef_int_exporters_5yr_avg.US = mean(export_volatility_regression_dsales_coef_int_exporters_5yr_vec.US(end-99:end));
%  export_volatility_regression_esales_coef_int_exporters_5yr_avg.US = mean(export_volatility_regression_esales_coef_int_exporters_5yr_vec.US(end-99:end));
%  export_volatility_regression_dom_ind_coef_int_exporters_5yr_avg.US = mean(export_volatility_regression_dom_ind_coef_int_exporters_5yr_vec.US(end-99:end));
%  export_volatility_regression_exp_ind_coef_int_exporters_5yr_avg.US = mean(export_volatility_regression_exp_ind_coef_int_exporters_5yr_vec.US(end-99:end));

% VOLATILITY BY EXPORT SHARE BIN AMONG EXPORTERS
% volatility_export_share_bin_1_avg.US = mean(volatility_export_share_bin_1.US(end-99:end));
% volatility_export_share_bin_2_avg.US = mean(volatility_export_share_bin_2.US(end-99:end));
% volatility_export_share_bin_3_avg.US = mean(volatility_export_share_bin_3.US(end-99:end));
% volatility_export_share_bin_4_avg.US = mean(volatility_export_share_bin_4.US(end-99:end));
% volatility_export_share_bin_5_avg.US = mean(volatility_export_share_bin_5.US(end-99:end));
% volatility_export_share_bin_6_avg.US = mean(volatility_export_share_bin_6.US(end-99:end));


% CALCULATE A FEW KEY AVERAGE MOMENTS FOR THE OUTPUT FROM THE FUNCTION
prob_import_innovation_to_export_avg.US = mean(prob_import_innovation_to_export.US(end-99:end));
prob_import_innovation_to_nontraded_avg.US  = mean(prob_import_innovation_to_nontraded.US(end-99:end));
prob_nontraded_innovation_to_export_avg.US  = mean(prob_nontraded_innovation_to_export.US(end-99:end));
prob_nontraded_innovation_to_nontraded_avg.US =  mean(prob_nontraded_innovation_to_nontraded.US(end-99:end));

prob_import_innovation_to_export_avg.OECD = mean(prob_import_innovation_to_export.OECD(end-99:end));
prob_import_innovation_to_nontraded_avg.OECD  = mean(prob_import_innovation_to_nontraded.OECD(end-99:end));
prob_nontraded_innovation_to_export_avg.OECD  = mean(prob_nontraded_innovation_to_export.OECD(end-99:end));
prob_nontraded_innovation_to_nontraded_avg.OECD =  mean(prob_nontraded_innovation_to_nontraded.OECD(end-99:end));

% GROWTH
TFP_growth.US = geomean(qual_consumed_growth_rate.US(end-149:end));
TFP_growth.OECD = geomean(qual_consumed_growth_rate.OECD(end-149:end));
tornqvist_TFP_growth.US = geomean(tornqvist_TFP_growth_vec.US(end-149:end));
tornqvist_TFP_growth.OECD = geomean(tornqvist_TFP_growth_vec.OECD(end-149:end));
real_wage_growth.US = geomean(real_wage_growth_vec.US(end-149:end));
real_wage_growth.OECD = geomean(real_wage_growth_vec.OECD(end-149:end));

% EXPORTS, WAGES, & LABOR SHARE
x_avg = mean(x_vec(end-99:end));
m_avg = mean(m_vec(end-99:end));
omega_avg = mean(omega_vec(end-99:end));
relative_product_wage_avg = mean(relative_product_wage_vec(end-99:end));
agg_export_revenue_share_avg.US = mean(export_share.US(end-99:end));
agg_export_revenue_share_avg.OECD = mean(export_share.OECD(end-99:end));
labor_share_avg.US = mean(labor_share.US(end-99:end));
labor_share_avg.OECD = mean(labor_share.OECD(end-99:end));

% FIRM MOMENTS
std_dev_firm_employment_avg.US = mean(std_dev_firm_output.US(end-99:end));
std_dev_firm_TFPR_avg.US = mean(std_dev_firm_TFPR.US(end-99:end));
std_dev_firm_TFPR_exporters_avg.US = mean(std_dev_firm_TFPR_exporters.US(end-99:end));
std_dev_firm_TFPR_non_exporters_avg.US = mean(std_dev_firm_TFPR_non_exporters.US(end-99:end));
mean_firm_TFPR_exporters_avg.US = mean(mean_firm_TFPR_exporters.US(end-99:end));
mean_firm_TFPR_non_exporters_avg.US = mean(mean_firm_TFPR_non_exporters.US(end-99:end));
diff_firm_TFPR_export_status.US = mean_firm_TFPR_exporters_avg.US - mean_firm_TFPR_non_exporters_avg.US;
mean_employment_exporters_avg.US = mean(mean_employment_exporters.US(end-99:end));
mean_employment_non_exporters_avg.US = mean(mean_employment_non_exporters.US(end-99:end));
var_firm_TFPR_avg.US = mean(var_firm_TFPR.US(end-99:end));

share_export_revenues_stopped_exporters_5yr_avg = mean(share_export_revenue_all_stopped_exporters_5yr_vec.US(end-99:end));
share_export_revenues_new_exporters_5yr_avg = mean(share_export_revenue_all_new_exporters_5yr_vec.US(end-99:end));

% EXPORT REALLOCATION
share_lost_exports_1yr_US = mean(share_lost_exports_1yr.US(end-99:end));
share_lost_exports_1yr_OECD = mean(share_lost_exports_1yr.OECD(end-99:end));
share_lost_exports_5yr_US = mean(share_lost_exports_5yr.US(end-99:end));
share_lost_exports_5yr_OECD = mean(share_lost_exports_5yr.OECD(end-99:end));

% JOB REALLOCATION
share_jobs_exiters_5yr_avg = mean(share_employment_exiters_5yr.US);
share_jobs_dom_entrants5yrs_avg = mean(share_jobs_dom_entrants5yrs.US(end-99:end));

job_destruction1yr = mean(-share_lost_output_contracting_incumbents_1yr.US(end-99:end) + share_jobs_exiters_1yr.US(end-99:end));
job_creation1yr = mean(share_added_output_expanding_incumbents_1yr.US(end-99:end) + share_jobs_dom_entrants.US(end-99:end));
job_destruction5yr = mean(-share_lost_output_contracting_incumbents_5yr.US(end-99:end) + share_jobs_exiters_5yr.US(end-99:end));
job_creation5yr = mean(share_added_output_expanding_incumbents_5yr.US(end-99:end) + share_jobs_dom_entrants5yrs.US(end-99:end));

job_destruction_exports_1yr = mean(-share_lost_output_contracting_exporters_1yr.US(end-99:end) + share_output_all_new_exporters.US(end-99:end));
job_creation_exports_1yr = mean(share_added_output_expanding_exporters_1yr.US(end-99:end) + share_output_all_stopped_exporters.US(end-99:end));
job_destruction_exports_5yr = mean(-share_lost_output_contracting_exporters_5yr.US(end-99:end) + share_output_all_stopped_exporters_5yr.US(end-99:end));
job_creation_exports_5yr = mean(share_added_output_expanding_exporters_5yr.US(end-99:end) + share_output_all_new_exporters_5yr.US(end-99:end));

job_destruction_large_firms_5yr = mean(-share_lost_output_large_incumbents_5yr.US(end-99:end) + share_employment_large_exiters_5yr.US(end-99:end));

job_destruction_imports_variety_level_5yr_avg = mean(job_destruction_imports_variety_level_5yr.US(end-99:end));
job_creation_exports_variety_level_5yr_avg = mean(job_creation_exports_variety_level_5yr.US(end-99:end));

job_destruction5yr_OECD = mean(-share_lost_output_contracting_incumbents_5yr.OECD(end-99:end) + share_jobs_exiters_5yr.OECD(end-99:end));
job_creation5yr_OECD = mean(share_added_output_expanding_incumbents_5yr.OECD(end-99:end) + share_jobs_dom_entrants5yrs.OECD(end-99:end));
job_creation_exports_5yr_OECD = mean(share_added_output_expanding_exporters_5yr.OECD(end-99:end) + share_output_all_new_exporters_5yr.OECD(end-99:end));
job_destruction_imports_variety_level_5yr_avg_OECD = mean(job_destruction_imports_variety_level_5yr.OECD(end-99:end));


% MARKUPS
produced_markups = [mean(avg_markups_produced_vec.US(end-99:end)); mean(avg_markups_produced_vec.OECD(end-99:end))];
consumed_markups = [mean(avg_markups_consumed_vec.US(end-99:end)); mean(avg_markups_consumed_vec.OECD(end-99:end))];
dispersion_consumed_markups = [mean(dispersion_markups_consumed_vec.US(end-99:end)); mean(dispersion_markups_consumed_vec.OECD(end-99:end))];




% group export elasticity
% group_export_elasticity_5yr.US = mean(group_export_elasticity_5yr_vec.US(end-99:end));
% group_export_elasticity_5yr.OECD = mean(group_export_elasticity_5yr_vec.OECD(end-99:end));
